package com.langxin.erp.util.security;

import org.apache.commons.codec.binary.Base64;

/**
 * Base64加密、解密
 * 
 * @author trunks
 * @version $Id: Base64Code.java, v 0.1 2012-6-7 下午5:20:31 trunks Exp $
 */
public class Base64Code {

    /**加密*/
    public static String encode(String str) {
        return Base64.encodeBase64String(str.getBytes());
    }

    /**加密*/
    public static String encode(byte[] str) {
        return Base64.encodeBase64String(str);
    }

    /**解密*/
    public static String decode(String str) {
        return new String(Base64.decodeBase64(str.getBytes()));
    }

    public static void main(String[] args) {
	    System.out.println(encode("8038501"));	
	    System.out.println(decode("ODAzODUwMQ=="));
	}
}
